﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace TileSetGenerator
{
    public class Tileset
    {
        public string textureName;
        public List<Rectangle> tiles = new List<Rectangle>();
        public int tileWidth;
        public int tileHeight;
        
        public int tilesWide;
        public int tilesHigh;

        public Tileset(string textureName, int tileWidth, int tileHeight, int tilesWide, int tilesHigh)
        {
            this.textureName = textureName;
            this.tileWidth = tileWidth;
            this.tileHeight = tileHeight;
            this.tilesWide = tilesWide;
            this.tilesHigh = tilesHigh;
            CreateRectangles();
        }

        private void CreateRectangles()
        {
            Rectangle rectangle = new Rectangle();
            rectangle.Width = this.tileWidth;
            rectangle.Height = this.tileHeight;
            tiles.Clear();
            for (int i = 0; i < tilesWide; i++)
            {
                for (int j = 0; j < tilesHigh; j++)
                {
                    rectangle.X = j * this.tileWidth;
                    rectangle.Y = i * this.tileHeight;
                    tiles.Add(rectangle);
                }
            }
        }
    }
}
